<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Auth::routes();
Route::any('test','Auth\LoginController@test');
Route::get('/home', 'HomeController@index')->name('home');

#二维码扫描访问接口
Route::any('/qrcode/{id}',function(){
    return returnData();
});


Route::get('/', function () {
    return 404;
});
Route::any('/oss/callback', function () {
    $all = request()->all();
    \Illuminate\Support\Facades\Log::info('osscallback',[$all] );
    return 200;
});
Route::group([
    'middleware' =>  ['wechat.oauth:default,snsapi_userinfo']
],function(){
    Route::any('web','WechatController@show');
    // 微信服务；
    Route::group([
        'prefix'        => 'wechat',
        'namespace'     => "Auth",
        'middleware' => []
    ],function(){
        Route::get('/user', function () {
            $user = session('wechat.oauth_user.default'); // 拿到授权用户资料
            dd($user);
        });
        Route::get('/userinfo','WechatAuthController@getUser');
    });
    // 课程
    Route::group([
        'prefix'        => 'curse',
        'namespace'     => "Curse",
        'middleware' => [
            'web',
        ]
    ],function(){
        Route::get('home','CurseController@home');
        Route::get('info','CurseController@info');
    });
});

// 微信服务
Route::any('wechat/serve','Auth\WechatAuthController@serve');
Route::any('wechat/oauth','Auth\WechatAuthController@oauth');
Route::get('/wechat/createmenu','WechatController@crateMenu');
Route::get('/wechat/material','WechatController@material');
Route::get('/wechat/testview','WechatController@testview'); # 测试二维码页面
#

# 授权回调地址；

Route::any('/qrcode/{id}',function(){
    return returnData();
});

//Route::any('web','WechatController@show');
Route::any('jsconfig','WechatController@jsconfig');

